#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
using namespace std;
const int N = 1e5 + 10;
int stnum[N], tn = 0, stop[N], to = 0;
int main()
{
    char input[N];
    scanf("%s", input);
    for (int i = 0; i < strlen(input); i++)
    {
        if (input[i] >= '0' && input[i] <= '9')
            stnum[++tn] = input[i] - '0';
        else if (input[i] == '+' || input[i] == '-' || input[i] == '*' || input[i] == '/' || input[i] == '(' || input[i] == ')')
            stop[++to] = input[i];
    }
    int ret = 0;
    while (tn > 1 || to)
    {
        int flag = 0;
        if (stop[to] == ')')
        {
            flag++;
            to--;
            while (flag)
            {
                if (stop[to] == ')')
                {
                    flag++;
                    to--;
                }
                else if (stop[to] == '(')
                {
                    flag--;
                    to--;
                }
                else
                {
                    if (stop[to] == '+')
                    {
                        ret = stnum[tn];
                        tn--;
                        stnum[tn] += ret;
                        to--;
                    }
                    else if (stop[to] == '-')
                    {
                        ret = -stnum[tn];
                        tn--;
                        stnum[tn] += ret;
                        to--;
                    }
                    else if (stop[to] == '*')
                    {
                        ret = stnum[tn];
                        tn--;
                        stnum[tn] *= ret;
                        to--;
                    }
                    else if (stop[to] == '/')
                    {
                        int num = stnum[tn];
                        tn--;
                        stnum[tn] /= num;
                        to--;
                    }
                }
            }
        }
        else
        {
            if (stop[to] == '+')
            {
                ret = stnum[tn];
                tn--;
                stnum[tn] = ret;
                to--;
            }
            else if (stop[to] == '-')
            {
                ret = -stnum[tn];
                tn--;
                stnum[tn] += ret;
                to--;
            }
            else if (stop[to] == '*')
            {
                ret = stnum[tn];
                tn--;
                stnum[tn] *= ret;
                to--;
            }
            else if (stop[to] == '/')
            {
                int num = stnum[tn];
                tn--;
                stnum[tn] /= num;
                to--;
            }
        }
    }
        printf("%d", stnum[1]);
    return 0;
}